package org.neuedu.chapter04_0617;

import java.util.Arrays;

public class ArrayDemo02 {
    public static void main(String[] args) {
        int[] arr = {4, 7, 5, 2, 1};
        // 桶排序
        boolean[] arr2 = new boolean[7];// 7 个 false
        for (int num : arr) {
            arr2[num - 1] = true;
        }
        System.out.println(Arrays.toString(arr2));
        for (int i = 0; i < arr2.length; i++) {
            if (arr2[i]) {
                System.out.println(i+1);
            }
        }
    }
}
